﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administration/main.master" AutoEventWireup="true" CodeBehind="StoreKeeper_AddPromotionItem.aspx.cs" Inherits="CS424_9pts.Administration.StoreKeeper_AddPromotionItem" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="server">

    <asp:Label ID="ItemName" runat="server" Text="ItemName"></asp:Label>
    <asp:TextBox ID="txbItemName" runat="server"></asp:TextBox>

    <asp:Label ID="ItemNum" runat="server" Text="Numbers"></asp:Label>
    <asp:TextBox ID="txbNum" runat="server"></asp:TextBox>
     <asp:Label ID="Label1" runat="server" Text="CarModel"></asp:Label>
    <asp:DropDownList ID="drlModels" runat="server" DataSourceID="CarModel" 
        DataTextField="ModelName" DataValueField="ModelID">
    </asp:DropDownList>
  
    <asp:Button ID="btnAdd" runat="server" Text="Add" onclick="btnAdd_Click" CssClass="adminButtonBlue" />
  

  <asp:SqlDataSource ID="CarModel" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>" 
    SelectCommand="SELECT [ModelName], [ModelID] FROM [CarModel]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="InsertPromotion" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>" 
        DeleteCommand="DELETE FROM [Promotion] WHERE [PromotionID] = @PromotionID" 
        InsertCommand="INSERT INTO [Promotion] ([Num], [Name]) VALUES (@Num, @Name)" 
        SelectCommand="SELECT [PromotionID], [Discount], [HasGift], [StartDate], [EndDate], [Status], [Num], [Name] FROM [Promotion] WHERE (([Num] = @Num) AND ([Name] = @Name))" 
        
        UpdateCommand="UPDATE [Promotion] SET [Discount] = @Discount, [HasGift] = @HasGift, [StartDate] = @StartDate, [EndDate] = @EndDate, [Status] = @Status, [Num] = @Num, [Name] = @Name WHERE [PromotionID] = @PromotionID">
        <DeleteParameters>
            <asp:Parameter Name="PromotionID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
               <asp:ControlParameter ControlID="txbNum" Name="Num" PropertyName="Text" 
                Type="Int32" />
            <asp:ControlParameter ControlID="txbItemName" Name="Name" PropertyName="Text" 
                Type="String" />
        </InsertParameters>
        <SelectParameters>
         
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Discount" Type="Double" />
            <asp:Parameter Name="HasGift" Type="Int32" />
            <asp:Parameter Name="StartDate" Type="DateTime" />
            <asp:Parameter Name="EndDate" Type="DateTime" />
            <asp:Parameter Name="Status" Type="Int32" />
            <asp:Parameter Name="Num" Type="Int32" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="PromotionID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>

